package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/**
 * 访问注解参数
 */
public class ReflectDemo11 {
    public static void main(String[] args) throws Exception{
        Class cls=Class.forName("reflect.Person");
        Method method = cls.getMethod("watchTV");
        if (method.isAnnotationPresent(AutoRunMethod.class)){
            AutoRunMethod annotation = method.getAnnotation(AutoRunMethod.class);
            int value = annotation.value();
            System.out.println("value参数的值为"+value);
        }else {
            System.out.println(method.getName()+"没有被标注");
        }
    }
}
